<route lang="yaml">
	meta:
	enabled: false
</route>

<script setup lang="ts">
	import { onMounted, ref } from 'vue'
	import type { TabsPaneContext } from 'element-plus'
	import { ElMessage, ElMessageBox } from 'element-plus'
	import shuju from '@/assets/data/order.json'
	import orderApi from '@/api/zhitan/order.ts'
	import productApi from '@/api/zhitan/product.ts'
	import dayjs from 'dayjs'
	import useUserStore from '@/store/modules/user'
	import axios from 'axios'
	import BigNumber from 'bignumber.js';

	const userStore : any = useUserStore()
	const pathurl : any = ref(`${import.meta.env.VITE_APP_API_BASEURL}`)
	const orderForm : any = ref({})
	const router = useRouter()
	const uploading : any = ref(false)
	const openShowRefound : any = ref(false)
	const activeName = ref('0')
	const loadingRef : any = ref(null)
	const loading : any = ref(false)
	const paging : any = ref({
		page: 1,
		limit: 10,
		// status: '1,2,6'
		user_str_type: 1
	})

	const tableData : any = ref([])
	const scheduletableData : any = ref([])

	const total : any = ref(0)

	const allcount : any = ref(0)
	const firstcount : any = ref(0)
	const secondcount : any = ref(0)
	const thirdcount : any = ref(0)
	const fourthcount : any = ref(0)
	const fivecount : any = ref(0)
	const baseurlimg : any = ref(`${import.meta.env.VITE_APP_API_BASEURLIMG}`)
	const nodata : any = new URL('@/assets/images/nodata.png', import.meta.url).href

	// 详情
	function detail(e : any) {
		router.push({
			name: 'ordermanagementadd',
			query: {
				id: e.id || null
			}
		})
	}
	const isshowpagcom : any = ref(true)
	const { pagination, getParams, onSizeChange, onCurrentChange, onSortChange } = usePagination()
	pagination.value.size = 20
	pagination.value.sizes = [20, 50, 100]

	// 表格数据
	// const url : any = ref(shuju)
	// const dataList = ref(url.value.data)
	const dataList : any = ref([])
	onMounted(() => {
		getList()
		getCount()
	})
	/* 切换菜单 */
	function handleClick(tab : TabsPaneContext, event : Event) {
		console.log(tab, event)
		// if(Number(tab.index)===0){
		// 	paging.value.status = '1,2'
		// }else if(Number(tab.index)===1){
		// 	paging.value.status = '1'
		// }else if(Number(tab.index)===2){
		// 	paging.value.status = '2'
		// }
		paging.value.page = 1
		if (Number(tab.index) === 1) {
			activeName.value = '2'
		} else if (Number(tab.index) === 2) {
			activeName.value = '1'
		} else {
			activeName.value = (tab.index) + ""
		}
		// activeName.value = (tab.index) + ""
		console.log(activeName.value, 'activeName.valueactiveName.value')
		getList()
		isshowpagcom.value = false
		setTimeout(() => {
			isshowpagcom.value = true
		}, 1000)

	}
	function getCount() {


		const obj : any = {}
		if (paging.value.order_code) {
			obj.order_code = paging.value.order_code
		} else {
			delete paging.value.order_code
			delete obj.order_code
		}
		if (paging.value.product_id) {
			obj.product_id = paging.value.product_id
		} else {
			delete paging.value.product_id
			delete obj.product_id
		}
		if (paging.value.user_str) {
			obj.user_str = paging.value.user_str
		} else {
			delete paging.value.user_str
			delete obj.user_str
		}
		if (paging.value.create_time) {
			obj.start_time = paging.value.create_time[0] / 1000
			obj.end_time = paging.value.create_time[1] / 1000
			obj.end_time = paging.value.end_time + 86399
		} else {
			delete paging.value.start_time
			delete paging.value.end_time
			delete obj.start_time
			delete obj.end_time
		}
		orderApi.order_list({ page: 1, limit: 1, group_id: paging.value.group_id ? paging.value.group_id : null, product_schedule_id: paging.value.product_schedule_id ? paging.value.product_schedule_id : null, status: '1,2,3,4,5,6', ...obj }).then((res : any) => {
			allcount.value = res.count
			console.log(res, 'resres')
		})
		orderApi.order_list({ page: 1, limit: 1, group_id: paging.value.group_id ? paging.value.group_id : null, product_schedule_id: paging.value.product_schedule_id ? paging.value.product_schedule_id : null, status: '1', ...obj }).then((res : any) => {
			firstcount.value = res.count
		})
		orderApi.order_list({ page: 1, limit: 1, group_id: paging.value.group_id ? paging.value.group_id : null, product_schedule_id: paging.value.product_schedule_id ? paging.value.product_schedule_id : null, status: '2', ...obj }).then((res : any) => {
			console.log(res, 'resres')
			secondcount.value = res.count
		})
		orderApi.order_list({ page: 1, limit: 1, group_id: paging.value.group_id ? paging.value.group_id : null, product_schedule_id: paging.value.product_schedule_id ? paging.value.product_schedule_id : null, status: '3', ...obj }).then((res : any) => {
			thirdcount.value = res.count
		})
		orderApi.order_list({ page: 1, limit: 1, group_id: paging.value.group_id ? paging.value.group_id : null, product_schedule_id: paging.value.product_schedule_id ? paging.value.product_schedule_id : null, status: '4,6', ...obj }).then((res : any) => {
			fourthcount.value = res.count
			console.log(res, 'resres')
		})
		orderApi.order_list({ page: 1, limit: 1, group_id: paging.value.group_id ? paging.value.group_id : null, product_schedule_id: paging.value.product_schedule_id ? paging.value.product_schedule_id : null, status: '5', ...obj }).then((res : any) => {
			fivecount.value = res.count
		})
	}
	function remoteMethodschedule(str : any) {
		productApi.ProductSchedule_list({ page: 1, limit: 1000, product_id: str }).then((res : any) => {
			if (res.code === 0) {
				scheduletableData.value = res.data
			}

		})
	}
	function changeProductId(str : any) {
		paging.value.product_schedule_id = null
		remoteMethodschedule(str)
	}
	function remoteMethod(str : any) {
		productApi.Product_list({ page: 1, limit: 10, name: str }).then((res : any) => {
			if (res.code === 0) {
				tableData.value = res.data
			}

		})
	}
	function searchData() {
		getList()
		getCount()
	}
	function searchReset() {
		getList()
		getCount()
	}

	function getList() {
		loadingRef.value.open(500)
		if (paging.value.create_time) {
			paging.value.start_time = paging.value.create_time[0] / 1000
			paging.value.end_time = paging.value.create_time[1] / 1000
			paging.value.end_time = paging.value.end_time + 86399
		} else {
			delete paging.value.start_time
			delete paging.value.end_time
		}
		if (paging.value.hexiao_time) {
			paging.value.check_start_time = paging.value.hexiao_time[0] / 1000
			paging.value.check_end_time = paging.value.hexiao_time[1] / 1000
			paging.value.check_end_time = paging.value.check_end_time + 86399
		} else {
			delete paging.value.check_start_time
			delete paging.value.check_end_time
		}
		if (!paging.value.statusstr || paging.value.statusstr.length === 0) {
			delete paging.value.statusstr
		}

		if (activeName.value === '0' && paging.value.statusstr) {
			paging.value.status = JSON.parse(JSON.stringify(paging.value.statusstr)).join(',')

		} else if (activeName.value === '0' && !paging.value.statusstr) {
			paging.value.status = '1,2,3,4,5,6'
			// delete paging.value.status
		} else if (activeName.value === '1') {
			paging.value.status = '1'
		} else if (activeName.value === '2') {
			paging.value.status = '2'
		} else if (activeName.value === '3') {
			paging.value.status = '3'
		} else if (activeName.value === '4') {
			paging.value.status = '4,6 '
		} else if (activeName.value === '5') {
			paging.value.status = '5'
		}

		orderApi.order_list(paging.value).then((res : any) => {
			if (res.code === 0) {
				res.data.forEach((i : any) => {
					// if (i.gift_json) {
					// 	i.gift_json = JSON.parse(i.gift_json)
					// }
					if (i.back_desc) {
						i.back_desc = JSON.parse(i.back_desc)
					}
				})

				dataList.value = res.data
				total.value = res.count
			}
		})
	}

	// 每页数量切换
	function sizeChange(e : any) {
		console.log(e, 'lll')
	}
	// 当前页码切换（翻页）
	function currentChange(e : any) {
		console.log(e, 'lll2')
		paging.value.page = e
		getList()
	}

	const form : any = ref({
		order_no: '2023070651565548',
		dec: '',
	})
	const formRules = ref({
		dec: [
			{ required: true, message: '请输入备注', trigger: 'blur' },
		],
		code: [
			{ required: true, message: '请输入核销码', trigger: 'blur' },
		],
		hxy_name: [
			{ required: true, message: '请选择核销员', trigger: 'blur' },
		],

	})

	const formRef = ref()

	function arraySpanMethod(row : any) {
		if (row.row.is_top_row !== 0) {
			return [1, 6]
		}
	}
	function exports() {
		// 导出
		const objs = JSON.parse(JSON.stringify(paging.value))
		Object.keys(objs).forEach((key : any) => {
			console.log(objs[key], objs[key] === null, '啦啦啦')
			if (!objs[key] || objs[key] === null) {
				delete objs[key]
			}
		});
		console.log(objs, '啦啦啦1')
		// 假设paging.value和pathurl.value是已经定义好的数据
		const queryString = Object.entries(objs)
			.map(([key, value]) => `${encodeURIComponent(key as any)}=${encodeURIComponent(value as any)}`)
			.join('&');

		const url = `${pathurl.value}ExportExcel/exportOrder?${queryString}`
		const link = document.createElement('a');
		link.href = url;
		link.setAttribute('download', '文件名'); // 设置下载文件的名称
		document.body.appendChild(link);
		link.click();
		document.body.removeChild(link);

	}

	function refundmoney(row : any) {
		orderForm.value = JSON.parse(JSON.stringify(row))
		orderForm.value.refund_money = orderForm.value.reality_price / 100
		orderForm.value.refuse_msg = ""
		orderForm.value.refoundtype = 1
		openShowRefound.value = true
		// const now = new Date();
		// const timeInSeconds = Math.floor(now.getTime() / 1000);
		// console.log(row.pay_time,timeInSeconds,timeInSeconds-row.pay_time,'rowrow')
		// if((timeInSeconds-row.pay_time)<300){
		// 	ElMessage({
		// 		type: 'info',
		// 		message: '付款五分钟后方可退款',
		// 	})
		// 	return
		// }
		// ElMessageBox.confirm(
		// 	'确认退款?',
		// 	'提示',
		// 	{
		// 		confirmButtonText: '确认',
		// 		cancelButtonText: '取消',
		// 		type: 'warning',
		// 	}
		// )
		// 	.then(() => {
		// 		console.log(row, 'row')
		// 		orderApi.order_refund({ id: row.id, money: row.reality_price }).then((res : any) => {
		// 			console.log(res, 'getinfo()')
		// 			if (res.code === 0) {
		// 				getinfo()
		// 			}

		// 		})
		// 		ElMessage({
		// 			type: 'success',
		// 			message: '操作成功',
		// 		})
		// 	})
		// 	.catch(() => { })
	}
	function submitedit() {
		// orderApi.order_edit({ id: orderForm.value.id, status: 1 }).then((res : any) => {
		// 	console.log(res, 'getinfo()')

		// })
		// return
		// if(!orderForm.value.refound_msg){
		// 	ElMessage({
		// 		type: 'info',
		// 		message: '请添加退款原因',
		// 	})
		// 	return
		// }
		// if(!orderForm.value.images){
		// 	ElMessage({
		// 		type: 'info',
		// 		message: '请添加退款备注图片',
		// 	})
		// 	return
		// }
		// if (orderForm.value.refund_money < 0) {
		// 	ElMessage({
		// 		type: 'info',
		// 		message: '退款金额不可为负数',
		// 	})
		// 	return
		// }
		// if (!orderForm.value.refund_money) {
		// 	ElMessage({
		// 		type: 'info',
		// 		message: '请输入退款金额',
		// 	})
		// 	return
		// }
		// if (Number(orderForm.value.refund_money) > Number(orderForm.value.reality_price) / 100) {
		// 	ElMessage({
		// 		type: 'info',
		// 		message: '退款金额不可大于实际支付金额',
		// 	})
		// 	return
		// }

		// return
		// orderApi.order_edit({ id: orderForm.value.id,refund_money: Number(orderForm.value.refund_money)*100, refuse_msg: orderForm.value.refound_msg?orderForm.value.refound_msg:'', status: 4, image: orderForm.value.images?orderForm.value.images.join(','):'' }).then((res : any) => {
		// 	console.log(res, 'getinfo()')
		// 	if (res.code === 0) {
		// 		openShowRefound.value = false 
		// 	}
		// })
		// orderApi.order_refund({ id: orderForm.value.id, money: Number(orderForm.value.refund_money)*100 }).then((res : any) => {
		// 	console.log(res, 'getinfo()')
		// 	if (res.code === 0) {
		// 		openShowRefound.value = false
		// 		getList()
		// 		getCount()
		// 		ElMessage({
		// 			type: 'success',
		// 			message: '操作成功',
		// 		})
		// 	}

		// })
		// console.log(new BigNumber(Number(orderForm.value.refund_money)).times(100).toNumber(), 'orderForm.value.refund_money')
		// return
		if (orderForm.value.status === 3) {
			if (orderForm.value.refoundtype === 1) {
				orderApi.order_refund({ id: orderForm.value.id, money: new BigNumber(Number(orderForm.value.refund_money)).times(100).toNumber(), refund_policy: orderForm.value.refund_policy ? orderForm.value.refund_policy : "" }).then((res : any) => {
					if (res.code === 0) {
						openShowRefound.value = false
						getList()
						getCount()
						ElMessage({
							type: 'success',
							message: '操作成功',
						})
					}

				})
			} else {
				orderApi.order_refuseRefund({ id: orderForm.value.id, refuse_msg: orderForm.value.refuse_msg }).then((res : any) => {
					if (res.code === 0) {
						openShowRefound.value = false
						getList()
						getCount()
						ElMessage({
							type: 'success',
							message: '操作成功',
						})
					}

				})
			}
		} else {
			orderApi.order_refund({ id: orderForm.value.id, money: new BigNumber(Number(orderForm.value.refund_money)).times(100).toNumber(), refund_policy: orderForm.value.refund_policy ? orderForm.value.refund_policy : "" }).then((res : any) => {
				if (res.code === 0) {
					openShowRefound.value = false
					getList()
					getCount()
					ElMessage({
						type: 'success',
						message: '操作成功',
					})
				}
			})
		}
	}
	function handleSuccess01(res : any) {
		if (res) {
			orderForm.value.images = orderForm.value.images || []
			orderForm.value.images.push(res)
		}
		else {
			// ElMessage.warning(res.error)
		}
	}
	function lookHetong(row : any) {
		// console.log(baseurlimg.value, 'baseurlimg.value')

		// window.open(baseurlimg.value + '/pdf/20240823142349_4.pdf')
		if (!row.contract_url) {
			ElMessage.warning('当前订单未绑定合同！')
			return
		}
		window.open(pathurl.value + row.contract_url)
	}
	function toCheck(row : any) {
		ElMessageBox.confirm(
			`确认核销当前订单?`,
			'提示',
			{
				confirmButtonText: '确认',
				cancelButtonText: '取消',
				type: 'warning',
			},
		)
			.then(() => {
				orderApi.order_check({ id: row.id }).then((res : any) => {
					if (res.code === 0) {
						getList()
						getCount()
						ElMessage({
							type: 'success',
							message: '操作成功',
						})
					}

				})
			})
			.catch(() => {
				// ElMessage({
				// 	type: 'info',
				// 	message: '已取消',
				// })
			})
	}
	function pagChange(e : any) {
		paging.value = Object.assign(paging.value, e)
		getList()
	}
</script>

<template>
	<div>
		<page-main>
			<el-form :inline="true" class="demo-form-inline">
				<el-row :gutter="24">
					<el-col :xs="6" :sm="24" :md="6" :lg="6">
						<el-form-item label="订单编号:" class="w-full">
							<el-input v-model="paging.order_code" class="w-full" placeholder="请输入订单号" clearable
								@clear="paging.order_code = null" />
						</el-form-item>
					</el-col>
					<el-col :xs="6" :sm="24" :md="6" :lg="6">
						<el-form-item label="产品名称:" class="w-full">
							<el-select v-model="paging.product_id" filterable remote reserve-keyword
								placeholder="请输入产品名称" :remote-method="remoteMethod" :loading="loading" class="w-full"
								@change="changeProductId" @clear="paging.product_id = null">
								<el-option v-for="item in tableData" :key="item.id" :label="item.name"
									:value="item.id" />
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :xs="6" :sm="24" :md="6" :lg="6">
						<el-form-item label="营期:" class="w-full">
							<el-select :disabled="!paging.product_id" v-model="paging.product_schedule_id" remote
								@clear="paging.product_schedule_id = null" clearable reserve-keyword placeholder="请选择营期"
								class="w-full">
								<el-option v-for="item in scheduletableData" :key="item.id" :label="item.name"
									:value="item.id" />
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :xs="6" :sm="24" :md="6" :lg="6">
						<el-form-item label="用户查找:" class="w-full">
							<el-input v-model="paging.user_str" class="w-full"
								:placeholder="paging.user_str_type===1?'请输入用户手机号':paging.user_str_type===2?'请输入用户昵称':paging.user_str_type===3?'请输入用户ID':'用户手机号/昵称/ID'"
								@clear="paging.user_str = null" clearable>
								<template #append>
									<el-select v-model="paging.user_str_type" placeholder="搜索类型" style="width: 115px">
										<el-option label="手机号" :value="1" />
										<el-option label="昵称" :value="2" />
										<el-option label="id" :value="3" />
									</el-select>
								</template>
							</el-input>
						</el-form-item>
					</el-col>

					<el-col :xs="6" :sm="24" :md="6" :lg="6">
						<el-form-item label="约伴编号:" class="w-full">
							<el-input v-model="paging.group_id" class="w-full" placeholder="请输入约伴编号" clearable
								type="number" @clear="paging.group_id = null" />
						</el-form-item>
					</el-col>
					<el-col :xs="7" :sm="24" :md="7" :lg="7">
						<el-form-item label="下单时间:">
							<el-date-picker v-model="paging.create_time" type="daterange" range-separator="至"
								value-format="x" start-placeholder="开始日期" end-placeholder="结束日期" />
						</el-form-item>
					</el-col>
					<el-col :xs="6" :sm="24" :md="6" :lg="6">
						<el-form-item>
							<el-button type="primary" @click="searchData()">
								<template #icon>
									<svg-icon name="ep:search" />
								</template>
								查询
							</el-button>
							<el-button @click="paging = {
						  page: 1,
						  limit: 10, 
						  user_str_type :1
						}, searchReset()">
								重置
							</el-button>
							<el-button type="success" @click="exports()"
								v-if="userStore.permissions.includes('ordermanagementexport')">
								<template #icon>
									<svg-icon name="ep:filter" />
								</template>
								导出
							</el-button>
						</el-form-item>
					</el-col>
				</el-row>

				<!-- <el-form-item label="核销时间:">
					<el-date-picker v-model="paging.hexiao_time" type="daterange" range-separator="至" value-format="x"
						start-placeholder="开始日期" end-placeholder="结束日期" />
				</el-form-item> -->

			</el-form>
			<el-tabs v-model="activeName" @tab-click="handleClick">
				<el-tab-pane :label="`全部订单(${allcount})`" name="0" />
				<el-tab-pane :label="`已核销(${secondcount})`" name="2" />
				<el-tab-pane :label="`待使用(${firstcount})`" name="1" />
				<el-tab-pane :label="`退费申请中(${thirdcount})`" name="3" />
				<el-tab-pane :label="`已退费(${fourthcount})`" name="4,6" />
				<el-tab-pane :label="`拒绝退款(${fivecount})`" name="5" />
				<!-- <el-tab-pane :label="`未成团退款(${fivecount})`" name="6" /> -->
			</el-tabs>



			<div class="pr" v-loading="uploading">
				<div class="tables tables-top">
					<div class="table-top table-row">
						<div class="list-inner goods-des tc flex-1">
							产品
						</div>
						<div class="list-inner price tc">
							单价
						</div>
						<div class="list-inner num tc">
							数量
						</div>
						<!-- <div class="list-inner after_sale tc">
              售后
            </div> -->
						<div class="list-inner total_price tc">
							实付款
						</div>
						<div class="list-inner pay_type tc">
							下单类型
						</div>
						<!-- <div class="list-inner order_status tc">
							订单状态
						</div> -->
						<div class="list-inner order_statusmsg tc">
							订单状态
						</div>
						<div class="list-inner operation tc">
							操作
						</div>
					</div>
				</div>
				<div class="orderlist relative">
					<Loading ref="loadingRef" />
					<div v-if='dataList.length>0'>
						<div class="tables mb-4" v-for="(i,j) in dataList" :key="j">
							<div class="head">
								<div class="d-s-c flex-1">
									<!-- <el-tag type="success" size="small" class="mr-4" v-if="i.invite_applet_user_id>0">
										分销单
									</el-tag>
									<el-tag type="danger" size="small" class="mr-4" v-if="i.invite_applet_user_id===0">
										直客单
									</el-tag> -->
									<div class="fb">
										订单编号：<span class="gray6 fbn">{{i.order_code}}</span>
									</div>
									<!-- <div class="fb ml-2.5 mr-8">
                  复制
                </div> -->
									<div class="fb ml-2.5 mr-8">
										下单时间：<span
											class="gray6 fbn">{{ i.create_time>0?dayjs(i.create_time * 1000).format('YYYY-MM-DD HH:mm:ss') :''}}</span>
									</div>
									<div class="fb ml-2.5 mr-8">
										用户：<span
											class="gray6 fbn">{{i.applet_user_info&&i.applet_user_info.nick_name?i.applet_user_info.nick_name :''}}
											（ID：{{i.applet_user_info&&i.applet_user_info.id?i.applet_user_info.id :'-'}}）
											{{i.applet_user_info&&i.applet_user_info.phone?i.applet_user_info.phone :''}}</span>
									</div>
								</div>
							</div>
							<div class="table-row">
								<div class="goods-des flex-1">
									<div class="ops d-s-c">
										<!-- <ImagePreview :src="i.image" style="width: 120px;height: 80px;" /> -->
										<image-preview :src="i.image" :width="120" :height="80" />
										<div class="ml-2.5" style="width: calc(100% - 50px);">
											<div class="blue2 fb f14 text-ellipsis" style="max-width: 350px;">
												{{i.name}}
											</div>
											<div class="blue2 fb mt-1.5 f14 text-ellipsis" style="max-width: 350px;">
												{{`排&nbsp;&nbsp;&nbsp;期` }}：{{i.product_schedule_info?i.product_schedule_info.name:''}}
											</div>
											<div class="blue2 fb mt-1.5 f14 text-ellipsis" style="max-width: 350px;">
												监护人：{{i&&i.guardian_info&&i.guardian_info.name?i.guardian_info.name:''}}
											</div>
											<div class="blue2 fb mt-1.5 f14 flex items-center text-ellipsis flex-wrap"
												style="max-width: 350px;">
												{{`营&nbsp;&nbsp;&nbsp;员`}}：<span class="mr-1.5"
													v-for="(it,jt) in i.camper_list" :key="jt">{{it.name}}</span>
											</div>
											<!-- <div class="gray6 flex items-center f14 mt-1.5 text-ellipsis">
												赠品：
												<div v-if="i.fulfill_coupon_info">
													{{i.fulfill_coupon_info.name}}（￥{{i.fulfill_coupon_info.money/100}}）  
												</div>
												<div v-else>
													无赠品
												</div>
											</div> -->
										</div>
									</div>
									<!-- <div class="ops d-s-c">
                  <ImagePreview src="http://7fzzw2-app.029-360.com/images/2022/06/10/8f34cb72ac1244ee/dbe00c64535d6bff.png" style="width: 50px;height: 50px;" />
                  <div class="ml-2.5" style="width: calc(100% - 5px);">
                    <div class="blue2 fb f14">
                      扇子葵树
                    </div>
                    <div class="gray6 f14 mt-1.5">
                      赠品：矿泉水
                    </div>
                  </div>
                </div> -->
								</div>
								<div class="list-inner price">
									<div class="ops d-c-c">
										￥{{i.price/100}}
									</div>
									<!-- <div class="ops d-c-c tc">
                  ￥600.00
                </div> -->
								</div>
								<div class="list-inner num">
									<div class="ops d-c-c tc">
										{{i.num}}
									</div>
									<!-- <div class="ops d-c-c tc">
                  1
                </div> -->
								</div>

								<!-- <div class="list-inner after_sale">
                <span class="blue2">买家发起维权</span>
              </div> -->
								<div class="list-inner total_price tc">
									<div class="blue2 f16 fb">
										￥{{i.reality_price/100}}
									</div>
								</div>
								<div class="list-inner pay_type tc">
									<el-tag type="" v-if="i.type===1">
										单独购买
									</el-tag>
									<el-tag :style="{height:i.group_id>0?'44px':'24px'}" type="success"
										v-if="i.type===2">
										<span class="flex flex-wrap"><span class="py-1">约伴（发起者）</span><span class="py-1"
												v-if="i.group_id>0">约伴编号：{{i.group_id}}</span></span>
									</el-tag>
									<el-tag :style="{height:i.group_id>0?'44px':'24px'}" type="danger"
										v-if="i.type===3">
										<span class="flex flex-wrap"><span class="py-1">约伴（参与者）</span><span class="py-1"
												v-if="i.group_id>0">约伴编号：{{i.group_id}}</span></span>
									</el-tag>
								</div>
								<!-- <div class="list-inner order_status">
									<div class=" ">
										<el-tag type="info" v-if="i.status===0">
											待支付
										</el-tag>
										<el-tag type="" v-if="i.status===1">
											待使用
										</el-tag>
										<el-tag type="success" v-if="i.status===2">
											已核销
										</el-tag>
										<el-tag type="danger" v-if="i.status===3">
											退款申请中
										</el-tag>
										<el-tag type="info" v-if="i.status===4">
											已退款
										</el-tag>
										<el-tag type="warning" v-if="i.status===5">
											拒绝退款
										</el-tag>
									</div>
								</div> -->
								<div class="list-inner flex justify-center items-center order_statusmsg">
									<div style="text-align: left; ">
										<el-tag type="info" v-if="i.status===0">
											待支付
										</el-tag>
										<el-tag type="" v-if="i.status===1">
											待使用
										</el-tag>
										<el-tag type="success" v-if="i.status===2">
											已核销
										</el-tag>
										<el-tag type="danger" v-if="i.status===3">
											退款申请中
										</el-tag>
										<el-tag type="info" v-if="i.status===4">
											已退款
										</el-tag>
										<el-tag type="warning" v-if="i.status===5">
											拒绝退款
										</el-tag>
										<el-tag type="warning" v-if="i.status===6">
											未成团退款
										</el-tag>
										<div v-if="i.status===2">
											<div class="mt-1.5">
												核销时间：{{i.check_time>0? dayjs(i.check_time * 1000).format('YYYY-MM-DD HH:mm:ss'):'' }}

											</div>
											<div class="mt-1.5">
												核销人员：{{i.check_user_info&&i.check_user_info.realname ? i.check_user_info.realname:i.check_user_info&&i.check_user_info.nickname ? i.check_user_info.nickname:'' }}

											</div>
										</div>
										<div v-if="i.status===3">
											<div class="mt-1.5">
												申请时间：{{i.refund_time>0? dayjs(i.refund_time * 1000).format('YYYY-MM-DD HH:mm:ss'):'' }}

											</div>
											<div class="mt-1.5">
												申请退款原因：{{i.refund_msg||'' }}

											</div>
										</div>
										<div v-if="i.status===4 || i.status===6">
											<div class="mt-1.5">
												退款时间：{{i.refund_pass_time>0? dayjs(i.refund_pass_time * 1000).format('YYYY-MM-DD HH:mm:ss'):'' }}

											</div>
											<div class="mt-1.5">
												操作人员：{{i.refund_user_info&&i.refund_user_info.realname ? i.refund_user_info.realname:i.refund_user_info&&i.refund_user_info.nickname ? i.refund_user_info.nickname:'' }}

											</div>
											<div class="mt-1.5">
												退款政策：{{i.refund_policy||'' }}

											</div>
										</div>
										<div v-if="i.status===5">
											<div class="mt-1.5">
												操作时间：{{i.refusal_refund_time>0? dayjs(i.refusal_refund_time * 1000).format('YYYY-MM-DD HH:mm:ss'):'' }}
											</div>

											<div class="mt-1.5">
												操作人员：{{i.refund_user_info&&i.refund_user_info.realname ? i.refund_user_info.realname:i.refund_user_info&&i.refund_user_info.nickname ? i.refund_user_info.nickname:'' }}

											</div>
											<div class="mt-1.5">
												拒绝原因：{{i.refuse_msg||'' }}

											</div>

										</div>
									</div>
								</div>
								<div class="list-inner operation">
									<!-- -->
									<el-button
										v-if="i.status===3 && userStore.permissions.includes('ordermanagementrefund')"
										type="primary" text @click="refundmoney(i)">
										退款
									</el-button>
									<el-button
										v-if="i.status===1 && userStore.permissions.includes('ordermanagementforcerefund')"
										type="primary" text @click="refundmoney(i)">
										未成团退款
									</el-button>
									<el-button type="primary" text @click="detail(i)"
										v-if="userStore.permissions.includes('ordermanagementadd')">
										详情
									</el-button>
									<el-button type="primary" text @click="lookHetong(i)"
										v-if="userStore.permissions.includes('ordermanagementhetong')">
										合同
									</el-button>
									<el-button type="primary" text @click="toCheck(i)"
										v-if="(i.status===1)  && userStore.permissions.includes('ordermanagementhexiao')">
										核销
									</el-button>
								</div>
							</div>
							<div class="table-footer">
								<el-row>
									<el-col :sm="24" :md="12">
										<div class="">
											<span class="fb">用户备注：</span><span class="gray6">{{i.desc}}</span>
										</div>
									</el-col>
									<el-col :sm="24" :md="12">
										<div class="">
											<span class="fb">商家备注：</span><span
												class="blue2">{{i.back_desc?i.back_desc[0].remark:'暂无备注'}}</span><span
												class="gray9 ml10">(仅商家可见)</span>
										</div>
									</el-col>
								</el-row>
							</div>
						</div>
					</div>
					<div v-else class="flex justify-center items-center min-h-50">
						<div class="flex justify-center items-center d-c">
							<div>
								<img class="w-46 h-30" :src="nodata">
							</div>
							<div>
								暂无数据
							</div>
						</div>
					</div>
				</div>

				<!-- <el-pagination :current-page="paging.page" :total="total" :page-size="paging.size"
					:page-sizes="paging.sizes" :layout="paging.layout" :hide-on-single-page="false" class="pagination"
					background @current-change="currentChange" @size-change="sizeChange" /> -->
				<page-compon v-if='isshowpagcom' :page="paging.page" :size="paging.limit" :total="total"
					style="margin-top: 16px;" @pag-change="pagChange" />
			</div>
		</page-main>

		<el-dialog v-model="openShowRefound" :title="`${orderForm.status===1?'未成团退款':'订单退款'}`" width="460px">
			<el-form ref="formRef" :rules="formRules" :model="orderForm">

				<!-- <el-form-item label="退款原因: " label-width="90px">
					<el-input v-model="orderForm.refound_msg" type="textarea" />
				</el-form-item>
				<el-form-item label="退款备注图片" label-width="110px">
					<ImagesUpload v-model:url="orderForm.images" :width="80" :height="80" :max='9'
						@on-success="handleSuccess01($event)" />
				</el-form-item>
				<el-form-item label="退款金额: " label-width="90px">
					<el-input v-model="orderForm.refund_money" type="number" />
				</el-form-item> -->
				<el-form-item label="产品状态：" prop="refoundtype" v-if="orderForm.status===3">
					<el-radio-group v-model="orderForm.refoundtype">
						<el-radio :value="1">
							同意退款
						</el-radio>
						<el-radio :value="2">
							拒绝退款
						</el-radio>
					</el-radio-group>
				</el-form-item>
				<el-form-item label="拒绝退款原因: " label-width="90px" v-if="orderForm.refoundtype===2">
					<el-input v-model="orderForm.refuse_msg" type="textarea" />
				</el-form-item>
				<el-form-item label="退款金额: " label-width="90px" v-if="orderForm.refoundtype===1">
					<!-- <el-input v-model="orderForm.money" type="number" /> -->
					<el-input-number v-model="orderForm.refund_money" style="width: 100%;" size="large"
						placeholder="请输入退款金额" :min="0" :max="999999999" controls-position="right" />
				</el-form-item>
				<el-form-item label="退款政策: " label-width="90px" v-if="orderForm.refoundtype!==2">
					<el-input v-model="orderForm.refund_policy" :rows="4" type="textarea" />
				</el-form-item>
			</el-form>
			<template #footer>
				<el-button @click="openShowRefound = false">
					取消
				</el-button>
				<el-button type="primary" @click="submitedit()">
					确定
				</el-button>
			</template>
		</el-dialog>
	</div>
</template>

<style scoped lang="scss">
	.orderlist {
		margin-top: 10px;
		margin-bottom: 30px;
	}

	.tables {
		font-size: 14px;
		border: 1px solid #e5e5e5;
		border-radius: 4px;
		transition: all 0.3s ease;

		.head {
			padding: 10px 12px;
			font-size: 14px;
			background: #f9f9f9;
			border-bottom: 1px solid #e5e5e5;
		}
	}

	.tables.tables-top {
		border-radius: 0;
	}

	.table-row {
		display: -webkit-box;
		display: flex;
		display: flexbox;
		display: flex;
		place-content: space-around center;
	}

	.table-row>div {
		padding: 12px;
	}

	.tables .list-inner {
		vertical-align: middle;
		border-right: 1px solid #e2e2e2;
		text-align: center;
	}

	.tables .list-inner.price,
	.tables .list-inner.num {
		width: 140px;
		padding: 0 12px;
	}

	.tables .list-inner.num {
		width: 90px;
	}

	.tables .list-inner.total_price {
		width: 150px;
	}

	.tables .list-inner.pay_type {
		width: 120px;
	}

	.tables .list-inner.order_status {
		width: 100px;
	}

	.tables .list-inner.order_statusmsg {
		width: 250px;
	}

	.tables .list-inner.operation {
		flex-direction: row;
		align-items: center;
		width: 320px;
		text-align: center;
	}

	.tables .list-inner.after_sale {
		width: 120px;
		text-align: center;
	}

	.table-row .goods-des {
		padding: 0 12px;
		vertical-align: middle;
		border-right: 1px solid #e2e2e2;
	}

	.table-row.table-top {
		background: #f1f1f1;
	}

	.table-row .ops {
		min-height: 75px;
		padding: 12px;
		margin: 0 -12px;
		border-bottom: 1px solid #e2e2e2;
	}

	.table-row .ops:last-child {
		border-bottom: none;
	}

	.table-row .list-inner {
		display: -webkit-box;
		display: flex;
		display: flexbox;
		display: flex;
		flex-direction: column;
		justify-content: center;
	}

	.table-footer {
		padding: 10px;
		border-top: 1px solid #e5e5e5;
	}

	.table-footer>div {
		padding: 4px 0;
		font-size: 14px;
	}
</style>